package com.xy.decorate;

import com.xy.drink.Drink;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/6/12 11:41
 * @description
 */
public class Decorator extends Drink {

    private Drink drink;

    public Decorator(Drink drink) { // 聚合
        this.drink = drink;
    }

    @Override
    public float cost() {
        // 调料的价格 + 咖啡的价格
        return super.getPrice() + drink.cost();
    }

    @Override
    public String getDes() {
        return super.getDes() + " && " + drink.getDes();
    }
}
